$(document).ready(function (){
require(['abPanel',
		'plot',
		'drag',
		'echarts'] ,function (abPanel ,plot ,drag,echarts){

$("#setting_div").html($("#view_setting_div"));

event_init();

var oper_index_map =  new HashMap();
oper_index_map.put("47" ,"日志数量趋势|log_count_trend");///siem/logStatistics/getLogNumber getLogNumber2
oper_index_map.put("48" ,"日志解析统计|log_analysis_statistics");//getLogAnalyse getLogAnalyse2
oper_index_map.put("49" ,"过滤日志样本统计|filter_log_sample_statistics");//getLogFilter 气泡图 getLogFilter2 横向主图（堆积）
oper_index_map.put("50" ,"日志样本统计|log_sample_statistics");//getLogSample 饼图 getLogSample2 饼图
oper_index_map.put("51" ,"设备日志统计|device_log_statistics");//getLogEqu 纵向柱图(堆积) getLogEqu2 横向柱图（堆积） 
oper_index_map.put("52" ,"忽略报警统计|ignore_warn_statistics");//getLogPass 折线图 getLogPass2 饼图

var current_oper_index_data;

// 查询用户自定义模板
custom_template_get();

function custom_template_get(){
	um_ajax_get({
		url : "FlexConfig/queryFlexPod",
		paramObj : {'menuId' : 'logStatistics'},
		maskObj : "#content_div",
		successCallBack : function (data){
			var dataArray = data;
			current_oper_index_data = data;
			var fnArray = [];
			var podIdArray = [];
			for (var i = 0; i < dataArray.length; i++) {
				if (oper_index_map.get(dataArray[i].podId)
					&& dataArray[i].flagStatus == "0")
				{
					fnArray.push(oper_index_map.get(dataArray[i].podId).split("|")[1]);
					podIdArray.push(dataArray[i].podId);
				}
			}
			panel_render(fnArray ,podIdArray);
		}
	})
}

function event_init(){
	// 视图radio 点击事件
	$("[name=a]").click(function (){
		//g_dialog.waitingAlert($("#pg-container"));
	});

	$("#view_setting_i").click(function (){
		g_dialog.dialog($("#abPanel_tem").html(),{
			width:"800px",
			initAfter:initAfter,
			title:"日志统计",
			saveclick:save_click
		});

		function initAfter(el)
		{
			um_ajax_get({
				url : "FlexConfig/queryFlexPod",
				maskObj : el,
				successCallBack : function (data){
					var dataArray = data;
					var current_oper_index_data = data;
					var left_data = [];
					var right_data = [];

					for (var i = 0; i < current_oper_index_data.length; i++) {
						if (oper_index_map.get(current_oper_index_data[i].podId))
						{
							var tmp = oper_index_map.get(current_oper_index_data[i].podId);
							if (current_oper_index_data[i].flagStatus == 1){
								left_data.push({text:tmp.split("|")[0] ,value:current_oper_index_data[i].podId + "|" + tmp.split("|")[1]});
							}
							else{
								right_data.push({text:tmp.split("|")[0] ,value:current_oper_index_data[i].podId + "|" + tmp.split("|")[1]});
							}
						}
					}

					abPanel.render(el.find("[id=abPanel]") ,{
						left_data:left_data,
						right_data:right_data
					});
				}
			})				
		}

		function save_click(el){
			var dataArray = abPanel.getValue(el.find("[id=abPanel]"));
			var idArray = [];
			var fnArray = [];
			for (var i = 0; i < dataArray.length; i++) {
				idArray.push(dataArray[i].split("|")[0]);
				fnArray.push(dataArray[i].split("|")[1]);
			}
			if (dataArray.length < 2)
			{
				g_dialog.dialogTip(el ,{
					msg : "请至少选择两个展示项"
				});
				return false;
			}
			um_ajax_get({
				url : "FlexConfig/updFlexConfig",
				paramObj : {podId:idArray.join(",") ,menuId : 'logStatistics'},
				maskObj : el,
				successCallBack : function(data){
					g_dialog.hide(el);
					panel_render(fnArray ,idArray);
				}
			});
		}
	});

	$("#panel-list").delegate('[class*=icon-remove]', 'click', function() {
		$(this).closest("[data-id=panel]").animate({opacity: 0},
				300, function() {
				$(this).remove();
				resize();
		});

		function resize()
		{
			var col = panel_col_get($("[data-id=panel]").size());
			$("[data-id=panel]").each(function (){
				$(this).attr("class" ,"col-md-"+col+" pr5 pl5");
			});
		}			
	});

	$("#view_save_i").click(function (){
		var podIdArray = [];
		$("[data-podid]").each(function (){
			podIdArray.push($(this).attr("data-podid"));
		});
		um_ajax_get({
			url : "FlexConfig/updFlexConfig",
			paramObj : {podId:podIdArray.join(",")},
			successCallBack : function(data){
				g_dialog.operateAlert();
			}
		});
	});
}

function panel_render(panelIdArray ,podIdArray)
{
	$("#panel-list").empty();
    var tmp = '<div class="col-md-4 pr5 pl5" data-id="panel">'
			    +'<div class="panel panel-default panel-sel panel-style grid-drable-div prel" style="height:330px">'
			    + '<div class="panel-heading font-bold prel grid-drable-head">'
			    +   '<span data-id="panel_title" class="abpanel-head"></span>'
			    +  '<div class="pabs" style="right:10px;top:10px">'
			    +     '<i class="icon-remove icon-animate f14 dn"></i>'
			    +  '</div>'
			    + '</div>'
			    +  '<div data-id="panel-body" class="panel-body p1" style="height: 292px;padding: 10px">'
			    +   '<div class="prel" style="height: 100%;" data-id="panel-content"></div>'
			    + '</div>'
			    + '</div>'
			    + '</div>';
	var buffer = [];
	var title;
	var el;
	var col = panel_col_get(panelIdArray.length);
	var id;
	for (var i=0;i<panelIdArray.length;i++)
	{
		fn = panelIdArray[i];
		el = $(tmp).clone();
		el.attr("class" ,"col-md-"+col+" pr5 pl5");
		id = podIdArray[i];
		el.attr("id" ,id);
		el.children().attr("data-podId" ,podIdArray[i]);
		$("#panel-list").append(el);
		if (panelIdArray.length == 1 || panelIdArray.length == 2)
		{
			el.height($("#content_div").height());
			el.children().eq(0).height($("#content_div").height()-12);
			el.find("[data-id=panel-body]").height($("#content_div").height()-85)
		}
		eval(fn + '("'+id+'")');
	}
	drag.drag();
}

function panel_col_get(panelNum){
	var col = 0;
	switch (panelNum)
	{
		case 1 :
			col = 12;
			break;
		default :
			col = 6;
	}
	return col;
}

// -------------------------------------------------------------------------------
function log_count_trend(elId,selFlag)
{
	var el = $("#" + elId);
	if (!selFlag)
	{
		el.find("[data-id=panel_title]").text("日志数量趋势");
		dayToYearRender(el ,log_count_trend);
		goBackRender(el ,log_count_trend);
	}
	el.find('[data-id=goback-button]').hide();
	um_ajax_get({
		url :"/siem/logStatistics/getLogNumber",
		paramObj:{flag:el.find("select").val(),menuId:'logStatistics',podId:elId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			var myChart = echarts.init(el.find("[data-id=panel-content]")[0]);

			var xData = [],valueData = [],timeData = [];
			for(var i=0;i<data.length;i++){
				xData.push(data[i].lable);
				valueData.push(data[i].value);
				timeData.push(data[i].time);
			}

			var option = {
				// title: {
				// 	text: '堆叠区域图'
				// },
				tooltip : {
					trigger: 'axis'
				},
				legend: {
					data:['日志数量']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'category',
					boundaryGap : false,
					data : xData
				}
				],
				yAxis : [
				{
					type : 'value'
				}
				],
				series : [
				{
					name:'日志数量',
					type:'line',
					stack: '总量',
					areaStyle: {normal: {}},
					data:valueData
				}
				]
			};
			myChart.setOption(option);
			myChart.on('click',function (param){
				if(param.data){
					if(param.dataIndex!=undefined&&param.dataIndex!=null){
						log_count_trend2(el,param.data,timeData[param.dataIndex],myChart);
					}
				}
			});
		}
	});
}
function log_count_trend2(el ,data ,time ,myChart){
	um_ajax_get({
		url :"/siem/logStatistics/getLogNumber2",
		paramObj:{flag:el.find("select").val(),time : time},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			el.find('[data-id=goback-button]').show();
			myChart.clear();
			myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var valueData = [];
			for(var i=0;i<data.length;i++){
				valueData.push({name: data[i].lable,value: data[i].value});
			}
			var option = {
				legend: {
					data:['日志数量']
				},
				tooltip : {
					trigger: 'item',
					formatter: "{b} : {c} ({d}%)"
				},
				series : [
				{
					name:'日志数量',
					type:'pie',
					radius : '55%',
            		center: ['50%', '50%'],
					data:valueData
				}
				],
				animationType: 'scale',
				animationEasing: 'elasticOut',
				animationDelay: function (idx) {
					return Math.random() * 200;
				}
			}
			myChart.setOption(option);
		}
	});
}

function log_analysis_statistics(elId,selFlag)
{
	var el = $("#" + elId);
	if (!selFlag)
	{
		el.find("[data-id=panel_title]").text("日志解析统计");
		dayToYearRender(el ,log_analysis_statistics);
		goBackRender(el ,log_analysis_statistics);
	}
	el.find('[data-id=goback-button]').hide();
	um_ajax_get({
		url :"/siem/logStatistics/getLogAnalyse",
		paramObj:{flag:el.find("select").val(),menuId:'logStatistics',podId:elId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			var myChart = echarts.init(el.find("[data-id=panel-content]")[0]);

			var xData = [],valueData1 = [],timeData = [],valueData2 = [],valueData3 = [];
			for(var i=0;i<data.length;i++){
				xData.push(data[i].lable);
				valueData1.push(data[i].value1);
				valueData2.push(data[i].value2);
				valueData3.push(data[i].value3);
				timeData.push(data[i].time);
			}

			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['已格式化日志','未格式化日志','未知日志']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'category',
					data : xData
				}
				],
				yAxis : [
				{
					type : 'value'
				}
				],
				series : [
				{
					name:'已格式化日志',
					type:'bar',
					stack: '总量',
					data:valueData1,
					barMaxWidth : '64px'
				},
				{
					name:'未格式化日志',
					type:'bar',
					stack: '总量',
					data:valueData2,
					barMaxWidth : '64px'
				},
				{
					name:'未知日志',
					type:'bar',
					stack: '总量',
					data:valueData3,
					barMaxWidth : '64px'
				}
				]
			};
			myChart.setOption(option);
			myChart.on('click',function (param){
				if(param.data){
					if(param.dataIndex!=undefined&&param.dataIndex!=null){
						log_analysis_statistics2(el,param.data,timeData[param.dataIndex],myChart);
					}
				}
			});
		}
	});
}
function log_analysis_statistics2(el ,data ,time ,myChart){
	um_ajax_get({
		url :"/siem/logStatistics/getLogAnalyse2",
		paramObj:{flag:el.find("select").val(),time : time},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			el.find('[data-id=goback-button]').show();
			myChart.clear();
			myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var xData = [],valueData1 = [],timeData = [],valueData2 = [],valueData3 = [];
			for(var i=0;i<data.length;i++){
				xData.push(data[i].lable);
				valueData1.push(data[i].value1);
				valueData2.push(data[i].value2);
				valueData3.push(data[i].value3);
				timeData.push(data[i].time);
			}
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['已格式化日志','未格式化日志','未知日志']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'value'
				}
				],
				yAxis : [
				{
					type : 'category',
					data : xData
				}
				],
				series : [
				{
					name:'已格式化日志',
					type:'bar',
					data:valueData1,
					barMaxWidth : '64px'
				},
				{
					name:'未格式化日志',
					type:'bar',
					data:valueData2,
					barMaxWidth : '64px'
				},
				{
					name:'未知日志',
					type:'bar',
					data:valueData3,
					barMaxWidth : '64px'
				},
				]
			}
			myChart.setOption(option);
		}
	});
}

function log_sample_statistics(elId,selFlag)
{
	var el = $("#" + elId);
	if (!selFlag)
	{
		el.find("[data-id=panel_title]").text("日志样本统计");
		dayToYearRender(el ,log_sample_statistics);
		goBackRender(el ,log_sample_statistics);
	}
	el.find('[data-id=goback-button]').hide();
	um_ajax_get({
		url :"/siem/logStatistics/getLogSample",
		paramObj:{flag:el.find("select").val(),menuId:'logStatistics',podId:elId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			var lable = [],sampleId = [],timeData = [],value = [];
			var valueData = [];
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				sampleId.push(data[i].sampleId);
				value.push(data[i].value);
				timeData.push(data[i].time);
				valueData.push({name : data[i].lable,value : data[i].value});
			}
			var myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var option = {
				legend: {
					data:['日志样本']
				},
				tooltip : {
					trigger: 'item',
					formatter: "{b} : {c} ({d}%)"
				},
				series : [
				{
					name:'日志样本',
					type:'pie',
					radius : '55%',
            		center: ['50%', '50%'],
					data:valueData
				}
				],
				animationType: 'scale',
				animationEasing: 'elasticOut',
				animationDelay: function (idx) {
					return Math.random() * 200;
				}
			}
			myChart.setOption(option);
			myChart.on('click',function (param){
				if(param.data){
					if(param.dataIndex!=undefined&&param.dataIndex!=null){
						log_sample_statistics2(el,param.data,sampleId[param.dataIndex],myChart);
					}
				}
			});
		}
	});
}
function log_sample_statistics2(el,data,sampleId,myChart){
	um_ajax_get({
		url :"/siem/logStatistics/getLogSample2",
		paramObj:{flag:el.find("select").val(),sampleId : sampleId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			el.find('[data-id=goback-button]').show();
			myChart.clear();
			myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var valueData = [];
			for(var i=0;i<data.length;i++){
				valueData.push({name : data[i].lable,value : data[i].value});
			}
			var option = {
				legend: {
					data:['日志样本']
				},
				tooltip : {
					trigger: 'item',
					formatter: "{b} : {c} ({d}%)"
				},
				series : [
				{
					name:'日志样本',
					type:'pie',
					radius : '55%',
            		center: ['50%', '50%'],
					data:valueData
				}
				],
				animationType: 'scale',
				animationEasing: 'elasticOut',
				animationDelay: function (idx) {
					return Math.random() * 200;
				}
			}
			myChart.setOption(option);
		}
	});
}

function device_log_statistics(elId,selFlag)
{
	var el = $("#" + elId);
	if (!selFlag)
	{
		el.find("[data-id=panel_title]").text("设备日志统计");
		dayToYearRender(el ,device_log_statistics);
		goBackRender(el ,device_log_statistics);
	}
	el.find('[data-id=goback-button]').hide();
	um_ajax_get({
		url :"/siem/logStatistics/getLogEqu",
		paramObj:{flag:el.find("select").val(),menuId:'logStatistics',podId:elId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			var lable = [],formatNum = [],unFormatNum = [] ,unknownNum = [],edTypeId = [],edTypeName= [];
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				formatNum.push(data[i].value1);
				unFormatNum.push(data[i].value2);
				unknownNum.push(data[i].value3);
				edTypeId.push(data[i].edTypeId);
				edTypeName.push(data[i].edTypeName);
			}
			var myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['已格式化日志','未格式化日志','未知日志']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'category',
					data : lable
				}
				],
				yAxis : [
				{
					type : 'value'
				}
				],
				series : [
				{
					name:'已格式化日志',
					type:'bar',
					data:formatNum,
					barMaxWidth : '64px'
				},
				{
					name:'未格式化日志',
					type:'bar',
					data:unFormatNum,
					barMaxWidth : '64px'
				},
				{
					name:'未知日志',
					type:'bar',
					data:unknownNum,
					barMaxWidth : '64px'
				}
				]
			}
			myChart.setOption(option);
			myChart.on('click',function (param){
				if(param.data){
					if(param.dataIndex!=undefined&&param.dataIndex!=null){
						device_log_statistics2(el,param.data,edTypeId[param.dataIndex],myChart);
					}
				}
			});
		}
	});
}
function device_log_statistics2(el,data,edTypeId,myChart){
	um_ajax_get({
		url :"/siem/logStatistics/getLogEqu2",
		paramObj:{flag:el.find("select").val(),edTypeId : edTypeId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			el.find('[data-id=goback-button]').show();
			myChart.clear();
			myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var lable = [],formatNum = [],unFormatNum = [] ,unknownNum = []
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				formatNum.push(data[i].value1);
				unFormatNum.push(data[i].value2);
				unknownNum.push(data[i].value3);
			}
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['已格式化日志','未格式化日志','未知日志']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'value'
				}
				],
				yAxis : [
				{
					type : 'category',
					data : lable
				}
				],
				series : [
				{
					name:'已格式化日志',
					type:'bar',
					data:formatNum,
					barMaxWidth : '64px'
				},
				{
					name:'未格式化日志',
					type:'bar',
					data:unFormatNum,
					barMaxWidth : '64px'
				},
				{
					name:'未知日志',
					type:'bar',
					data:unknownNum,
					barMaxWidth : '64px'
				}
				]
			}
			myChart.setOption(option);
		}
	});
}
function ignore_warn_statistics(elId,selFlag)
{
	var el = $("#" + elId);
	if (!selFlag)
	{
		el.find("[data-id=panel_title]").text("忽略报警统计");
		dayToYearRender(el ,ignore_warn_statistics);
		goBackRender(el ,ignore_warn_statistics);
	}
	el.find('[data-id=goback-button]').hide();
	um_ajax_get({
		url :"/siem/logStatistics/getLogPass",
		paramObj:{flag:el.find("select").val(),menuId:'logStatistics',podId:elId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			var lable = [],aggCnt = [],ignoreCnt = [],time = [];
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				aggCnt.push(data[i].value1);
				ignoreCnt.push(data[i].value2);
				time.push(data[i].time);
			}
			var myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['聚合总数','忽略总数']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'category',
					data : lable
				}
				],
				yAxis : [
				{
					type : 'value'
				}
				],
				series : [
				{
					name:'聚合总数',
					type:'line',
					data:aggCnt,
					barMaxWidth : '64px'
				},
				{
					name:'忽略总数',
					type:'line',
					data:ignoreCnt,
					barMaxWidth : '64px'
				}
				]
			}
			myChart.setOption(option);
			myChart.on('click',function (param){
				if(param.data){
					if(param.dataIndex!=undefined&&param.dataIndex!=null){
						ignore_warn_statistics2(el,param.data,time[param.dataIndex],myChart);
					}
				}
			});
		}
	});
}
function ignore_warn_statistics2(el,data,time,myChart){
	um_ajax_get({
		url :"/siem/logStatistics/getLogPass2",
		paramObj:{flag:el.find("select").val(),time : time},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			el.find('[data-id=goback-button]').show();
			myChart.clear();
			myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var lable = [],aggCnt = [],ignoreCnt = [];
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				aggCnt.push(data[i].value1);
				ignoreCnt.push(data[i].value2);
			}
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['分析后报警','已忽略报警']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'value'
				}
				],
				yAxis : [
				{
					type : 'category',
					data : lable
				}
				],
				series : [
				{
					name:'分析后报警',
					type:'bar',
					data:aggCnt,
					barMaxWidth : '64px'
				},
				{
					name:'已忽略报警',
					type:'bar',
					data:ignoreCnt,
					barMaxWidth : '64px'
				}
				]
			}
			myChart.setOption(option);
		}
	});
}

function filter_log_sample_statistics(elId,selFlag)
{
	var el = $("#" + elId);
	if (!selFlag)
	{
		el.find("[data-id=panel_title]").text("过滤日志样本统计");
		dayToYearRender(el ,filter_log_sample_statistics);
		goBackRender(el ,filter_log_sample_statistics);
	}
	el.find('[data-id=goback-button]').hide();
	um_ajax_get({
		url :"/siem/logStatistics/getLogFilter",
		paramObj:{flag:el.find("select").val(),menuId:'logStatistics',podId:elId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			var lable = [],time = [],edId = [],value1 = [],value2 = [];
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				time.push(data[i].time);
				edId.push(data[i].edId);
				value1.push(data[i].value1);
				value2.push(data[i].value2);
			}
			var myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				grid: {
					left: '3%',
					right: '9%',
					bottom: '3%',
					containLabel: true
				},
				xAxis: {
					splitLine: {
						lineStyle: {
							type: 'dashed'
						}
					}
				},
				yAxis: {
					splitLine: {
						lineStyle: {
							type: 'dashed'
						}
					},
					scale: true
				},
				xAxis : [
				{
					type : 'value'
				}
				],
				yAxis : [
				{
					type : 'category',
					data : lable
				}
				],
				series : [{
					name: '告警日志',
					data: value1,
					type: 'scatter'
				},{
					name: '过滤告警日志',
					data: value2,
					type: 'scatter'
				}
				]
			}
			myChart.setOption(option);
			myChart.on('click',function (param){
				console.log(param);
				if(param.data){
					if(param.dataIndex!=undefined&&param.dataIndex!=null){
						filter_log_sample_statistics2(el,param.data,edId[param.dataIndex],"",myChart);
					}
				}
			});
		}
	});
}
function filter_log_sample_statistics2(el,data,edId,colId,myChart){
	um_ajax_get({
		url :"/siem/logStatistics/getLogFilter2",
		paramObj:{flag:el.find("select").val(),edId : edId,colId : colId},
		maskObj : el.find("[class*=panel-style]"),
		successCallBack:function (data){
			el.find('[data-id=goback-button]').show();
			myChart.clear();
			myChart = echarts.init(el.find("[data-id=panel-content]")[0]);
			var lable = [],aggCnt = [],ignoreCnt = [];
			for(var i=0;i<data.length;i++){
				lable.push(data[i].lable);
				aggCnt.push(data[i].value1);
				ignoreCnt.push(data[i].value2);
			}
			var option = {
				tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
				legend: {
					data:['告警日志','发送过滤告警日志']
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
				{
					type : 'value'
				}
				],
				yAxis : [
				{
					type : 'category',
					data : lable
				}
				],
				series : [
				{
					name:'告警日志',
					type:'bar',
					data:aggCnt,
					barMaxWidth : '64px'
				},
				{
					name:'发送过滤告警日志',
					type:'bar',
					data:ignoreCnt,
					barMaxWidth : '64px'
				}
				]
			}
			myChart.setOption(option);
		}
	});
}

// -------------------------------------------------------------------------------
function dayToYearRender(el ,fn)
{
	var divel = $('<div class="pabs" style="width:100px;right:50px;top:10px;font-weight:normal;"></div>');
	var sel = $('<select data-type="select"></select>');
	divel.append(sel);
	el.find("[data-id=panel_title]").append(divel);

	sel.append('<option value="4">最近一天</option>');
	sel.append('<option value="5">最近一周</option>');
	sel.append('<option value="6">最近一月</option>');
	// sel.append('<option value="7">最近一季度</option>');
	// sel.append('<option value="8">最近一年</option>');


	sel.change(function (){
		fn(sel.closest("[data-id=panel]").attr("id") ,true);
	});

	index_form_init(el.find("[data-id=panel_title]"));
}
function goBackRender(el ,fn){
	var button;
	if(el.find('[data-id=goback-button]').length>0){
		button = el.find('[data-id=goback-button]');
	}else {
		button = $('<i data-id="goback-button" class="icon-reply" style="display:none;"></div>');
		var divel = $('<div class="pabs" style="width:100px;right:80px;top:13px;font-weight:normal;"></div>');
		divel.append(button);
		el.find("[data-id=panel_title]").append(divel);
	}
	button.click(function (e){
		fn(button.closest("[data-id=panel]").attr("id"),true);
	});
}

})
});